package com.smh.a05exerciseDemo2;

import java.util.ArrayList;

public class Test2 {
    public static void main(String[] args) {

        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student("zhangsan",12));
        list.add(new Student("lisi",14));
        list.add(new Student("wangwu",16));
        list.add(new Student("maliu",14));

//        1/类名::方法名被引用的方法形参是跟抽象方法第二个参数后面的保持一致
        String[] array = list.stream().map(Student::getName).toArray(String[]::new);

        for (String s : array) {
            System.out.println(s);
        }


    }
}
